package com.starinside.wp.foundation.exception;

import lombok.Setter;

/**
 * *******************************
 * Created by Tim.
 * form com.matt
 * on 2017/6/12
 * *******************************
 */
public class ExceptionConstant {



    public enum ErrorCode{
        SUCCESSFUL("000000", "请求成功！"),

        CREATE_ORDER_FAILED("000002", "下单失败！"),

        SIGN_ERROR("999998", "验签有误"),

        UNDEFINED("999999", "系统出错！");

        @Setter
        private String code;

        @Setter
        private String value;

        ErrorCode(String code, String value){
            this.code = code;
            this.value = value;
        }

        public String codeOf(){
            return code;
        }

        public String valueOf(){
            return value;
        }

        public ErrorCode get(String code){
            for (ErrorCode errorCode : values()) {
                if (errorCode.codeOf()==code)
                    return errorCode;
            }
            return null;
        }
    }
}
